<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
    <xsl:param name="DOTNET2"/>
    
    
    	<xsl:template match="Class">
	
		<xsl:variable name="Name" select="Name"/>
		<xsl:variable name="HeaderInfo" select="HeaderInfo/ProjectName"/>
		<xsl:variable name="IsComposite" select="IsComposite"/>
		
// GENNIT Castle ActiveRecord http://www.gennit.com
//
// Project: <xsl:value-of select="HeaderInfo/ProjectName"/>
//
// **************************************************************
// IMPORTANT BIT:
//
// This source code is is owned by you. No copyright is held by
// GENNIT. However, please note the disclaimer below
// **************************************************************
//
// GENNIT refers to the GENNIT website and anyone affiliated
// with the GENNIT system. Including but not limited to
// the administrator and service provider.
//
// Unless agreed to in writing, source code is distributed on an 
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. GENNIT are not responsible for 
// your use/misuse of this code.

// When you use GENNIT code, you do so at your own risk and 
// GENNIT is not responsible for the accuracy, 
// reliability or functionality of the code. GENNIT expressly 
// disclaims any potential liability associated with use of 
// this generated code.

		
		

using System;

using Castle.ActiveRecord;
using NHibernate.Expression;
using Iesi.Collections;


namespace <xsl:value-of select="HeaderInfo/ProjectName"/>.Dal  
{

	<![CDATA[/// <summary> ]]>
	/// <xsl:value-of select="Name"/> is a partial class which implements the
	/// base class methods to provide simpler access to ActiveRecord methods for this object.
	<![CDATA[/// </summary> ]]>
	public partial class <xsl:value-of select="Name"/><xsl:if test="IsNested='false'"> : <xsl:value-of select="HeaderInfo/ProjectName"/>.Dal.DataObject</xsl:if>
	{
	
	
		#region Active Record Accessors
		
		
		<![CDATA[/// <summary>
		/// Returns a count of the amount of rows for the type
		/// </summary>
		/// <param name="type">ActiveRecord type</param>
		/// <returns>amount of rows from database</returns>]]>
		public static int CountAll ( )
		{
			return DataObject.ARCountAll ( typeof ( <xsl:value-of select="Name"/> ) );
		}
		
		
		
		<![CDATA[/// <summary>
		/// Returns a count of the amount of rows for the type
		/// </summary>
		/// <param name="type">ActiveRecord type</param>
		/// <param name="filter">HQL string</param>
		/// <param name="args">HQL Parameters</param>
		/// <returns>amount of rows from database</returns>]]>
		public static int CountAll ( string filter, params object[] args )
		{
			return DataObject.ARCountAll ( typeof ( <xsl:value-of select="Name"/> ) , filter , args );
		}
		
		
		
		<![CDATA[/// <summary>
		/// Delete all records of the ActiveRecord type
		/// </summary>
		/// <param name="type">ActiveRecord type</param>]]>
		public static void DeleteAll ( )
		{
			DataObject.ARDeleteAll ( typeof ( <xsl:value-of select="Name"/> ) );
		}
		
		
		
		<![CDATA[/// <summary>
		/// Delete all recrods for the ActiveRecord type
		/// </summary>
		/// <param name="type">ActiveRecord type</param>
		/// <param name="where">HQL where clause</param>]]>
		public static void DeleteAll ( string where )
		{
			DataObject.ARDeleteAll ( typeof ( <xsl:value-of select="Name"/> ) , where );
		}
		
		
		
		<![CDATA[/// <summary>
		/// Returns all database objects of the ActiveRecord type
		/// </summary>
		/// <param name="type">ActiveRecord type</param>
		/// <returns>array of objects</returns>]]>
		public static <xsl:value-of select="Name"/>[] FindAll ( )
		{
			return (<xsl:value-of select="Name"/>[])DataObject.ARFindAll ( typeof ( <xsl:value-of select="Name"/> ) );
		}
		
		
		
		<![CDATA[/// <summary>
		/// Returns database objects of the ActiveRecord type
		/// which match the criteria
		/// </summary>
		/// <param name="type">ActiveRecord type</param>
		/// <param name="criterias">criteria array</param>
		/// <returns>array of objects</returns>]]>
		public static <xsl:value-of select="Name"/>[] FindAll ( params ICriterion[] criteria )
		{
			return (<xsl:value-of select="Name"/>[])DataObject.ARFindAll ( typeof ( <xsl:value-of select="Name"/> ) , criteria );
		}
		
		
		
		<![CDATA[/// <summary>
		/// Returns database objects of the ActiveRecord type
		/// using the primary key. ObjectID in the case of
		/// these objects.
		/// </summary>
		/// <param name="type">ActiveRecord type</param>
		/// <param name="id">PrimaryKey object Id</param>
		/// <returns>matching object</returns>]]>
		public static <xsl:value-of select="Name"/> FindByPrimaryKey ( object id )
		{
		
			return DataObject.ARFindByPrimaryKey ( typeof ( <xsl:value-of select="Name"/> ) , id )
				as <xsl:value-of select="Name"/>;
		}
		
		
		<![CDATA[/// <summary>
		/// Returns database objects of the ActiveRecord type
		/// using the primary key. ObjectID in the case of
		/// these objects.
		/// </summary>
		/// <param name="type">ActiveRecord type</param>
		/// <param name="id">PrimaryKey object Id</param>
		/// <param name="throwOnNotFound">true if you want to throw 
		/// exception on not finding the object, false to catch it</param>
		/// <returns>matching ActiveRecord object or null</returns>]]>
		public static <xsl:value-of select="Name"/> FindByPrimaryKey ( object id , bool throwOnNotFound )
		{
			return DataObject.ARFindByPrimaryKey ( typeof ( <xsl:value-of select="Name"/> ) , id , throwOnNotFound )
			 as <xsl:value-of select="Name"/>;
		}
		
		
		
		<![CDATA[/// <summary>
		/// Returns first object of the ActiveRecord type
		/// which matches the criteria
		/// </summary>
		/// <param name="type">ActiveRecord type</param>
		/// <param name="criterias">criteria array</param>
		/// <returns>first matching ActiveRecord object</returns>]]>
		public static <xsl:value-of select="Name"/> FindFirst ( params ICriterion[] criteria )
		{
			return DataObject.ARFindFirst ( typeof ( <xsl:value-of select="Name"/> ) , criteria )
				as <xsl:value-of select="Name"/>;
		}
		
		
		

		public new object Execute ( NHibernateDelegate call )
		{
			return base.Execute ( call );
		}
		
		
		
		<![CDATA[/// <summary>
		/// Return object based on a IActiveRecordQuery implementations
		/// such as ScalarQuery / SimpleQuery.
		/// </summary>
		/// <seealso cref="http://wiki.castleproject.org/index.php/ActiveRecord:Using_HQL"/>
		/// <param name="query">Query to execute</param>]]>
		/// <returns>object results of type specified within query</returns>		
		public static new object ExecuteQuery ( IActiveRecordQuery query )
		{
			return DataObject.ARExecuteQuery ( query );
		}
		
		
		
		
		
		#endregion
	
	}
	
	
}



	</xsl:template>
    
</xsl:stylesheet>